﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SEPD.CAD.Template.Command
{
    internal class TemplateConvertor
    {
    }

    public class IntBoolConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool valueTemp = System.Convert.ToBoolean(value);
            string parameterTemp = System.Convert.ToString(parameter); //默认项
            if ("ON" == parameterTemp)
            { return valueTemp ? 1 : 0; }
            else
            { return 0; }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int valueTemp = System.Convert.ToInt32(value);

            if (0 == valueTemp)
            { return false; }
            else
            { return true; }
        }
    }
}
